#!/bin/sh

set -eux

install_jia_prompt() {
  cargo install --path .
}

install_script_plugins() {
  rm -rf ~/.local/share/jia-prompt/plugins/
  mkdir -p ~/.local/share/jia-prompt/plugins/
  cp plugins/* ~/.local/share/jia-prompt/plugins/
}

install_c_plugins() {
  (cd plugins-c && ninja)
  cp plugins-c/bin/* ~/.local/share/jia-prompt/plugins/
}

install_fish_config() {
  cp shell/fish/fish_prompt.fish ~/.config/fish/functions/
}

main() {
  install_jia_prompt
  install_script_plugins
  install_c_plugins
  install_fish_config
}

main
